﻿
using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;


namespace Ken_WPF_UI.View
{
    /// <summary>
    /// ContextMenuWindow.xaml 的交互逻辑
    /// </summary>
    public partial class ContextMenuWindow : Window
    {
        public ContextMenuWindow()
        {
            InitializeComponent();
        }


        private void OtherSaveClick(object sender, RoutedEventArgs e)
        {
            if (sender is ContextMenuWindow)
            {
                ContextMenuWindow menu = sender as ContextMenuWindow;

                System.Windows.MessageBox.Show("快捷键文件另存为");
                return;
            }
            System.Windows.MessageBox.Show("文件另存为");
        }

        private void CopyClick(object sender, RoutedEventArgs e)
        {
            System.Windows.MessageBox.Show("点击Copy");
        }


        /// <summary>
        /// 鼠标左键 触发右键菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            contentMenu1.PlacementTarget = (UIElement)sender;
            contentMenu1.IsOpen = true;
        }

        private void OpenFileClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            DialogResult dialogResult = openFileDialog.ShowDialog();
            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Forms.MessageBox.Show("选择文件:" + openFileDialog.FileName);
            }
        }


    }
}
